package com.atguigu.stgy.admin.service.impl;

import com.atguigu.stgy.admin.service.FacilityInfoService;
import com.atguigu.stgy.model.enums.FacilityTypeEnum;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.stgy.admin.mapper.FacilityInfoMapper;
import com.atguigu.stgy.model.entity.FacilityInfo;

import java.util.List;

@Service
public class FacilityInfoServiceImpl extends ServiceImpl<FacilityInfoMapper, FacilityInfo> implements FacilityInfoService {

    @Override
    public List<FacilityInfo> listFacilityInfoByType(FacilityTypeEnum type) {
        LambdaQueryWrapper<FacilityInfo> wrapper = Wrappers.lambdaQuery(FacilityInfo.class);
        if(type!=null){
            wrapper.eq(FacilityInfo::getType , type.getType());
        }
        return baseMapper.selectList(wrapper);
    }
}
